package com.test.card.bean;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;

@Data
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserInfo {
    /**
     * 用户名称
     */
    @NotNull(message = "parameter 'user_name' can not be empty")
    private  String userName;

    /**
     * 电话
     */
    @NotNull(message = "parameter 'phone' can not be empty")
    @Pattern(regexp = "^1\\d{10}$",message = "手机号码格式错误")
    private String phone;

    /**
     * 会员卡号
     */
    @NotNull(message = "parameter 'cardt_no' can not be empty")
    @Pattern(regexp = "^A\\d{3}$",message = "会员卡号格式错误")
    private String cardNo;

    /**
     * 积分
     */
    private Integer point;

    /**
     * 激活时间
     */
    private LocalDateTime createTime;

}
